package com.example.administrator.wallet.view.activity.finds.kkbank;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;

import com.example.administrator.wallet.R;
import com.example.administrator.wallet.utils.DimbgUtils;


public class a3point extends AppCompatActivity {

    private ImageButton ib_three_next;
    private RelativeLayout activity_a3point;
    private View view;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_a3point);


        ib_three_next = (ImageButton)findViewById(R.id.ib_three_next);
        activity_a3point = (RelativeLayout)findViewById(R.id.activity_a3point);

        ib_three_next.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                initCurrency();
            }
        });
    }
    private void initCurrency() {
        view = View.inflate(this, R.layout.popup_record, null);
        final Button bt_Transaction_Records = (Button) view.findViewById(R.id.btn_transaction_records_popup_record);
        final Button bt_cancel = (Button) view.findViewById(R.id.bt_cancel);

        new Handler().post(new Runnable() {
            @Override
            public void run() {
                final PopupWindow window = new PopupWindow(view, RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT, true);
                window.setFocusable(true);
                window.setTouchable(true);
                window.setOutsideTouchable(true);
                window.showAtLocation(activity_a3point, Gravity.CENTER, 0, 0);
                Log.e("TAG-----", "OK");
                DimbgUtils.dimBackground(a3point.this, 0.5f);
                window.setOnDismissListener(new PopupWindow.OnDismissListener() {
                    @Override
                    public void onDismiss() {
                        DimbgUtils.dimBackground(a3point.this, 1.0f);
                    }
                });

                //成交记录
                bt_Transaction_Records.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        startActivity(new Intent(getApplicationContext(), com.example.administrator.wallet.view.activity.finds.kkbank.TransactionRecordsActivity.class));
                        window.dismiss();
                    }
                });

                bt_cancel.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        window.dismiss();
                    }
                });
            }
        });


    }
}
